package com.example.demo.dao;

import com.example.demo.pojo.Address;
import org.apache.commons.math3.analysis.function.Add;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AddressDao {

    //删除收货地址
    int deleteByPrimaryKey(Integer addressid);

    int insert(Address record);

    //新增收货地址
    int insertSelective(Address record);

    Address selectByPrimaryKey(Integer addressid);

    //修改收货地址
    int updateByPrimaryKeySelective(Address record);

    int updateByPrimaryKey(Address record);

    //通过用户id查询用户收货地址
    @Select("SELECT * FROM address WHERE userid=#{userid}")
    List<Address>  selectByUserId(int userid);

    //通过默认状态查询
    @Select("SELECT * FROM address where isdefault =#{isdefault}")
    List<Address> selectByisdefault(int isdefault);
}